import request from '../utils/request.js'
import store from '../store/index.js'

export function createStar(star) {
  return request({
    url: 'star/add/',
    method: 'post',
    data: star
  })
}

export function getAllStar() {
  return request({
    url: 'star/pass/all',
    method: 'get'
  })
}

export function getStarByStarId(starId) {
  return request({
    url: 'star/id/' + starId,
    method: 'get'
  })
}

export function getStarByStarStatus() {
  return request({
    url: 'star/status/0',
    method: 'get'
  })
}

export function publishStarByStarId(starId) {
  return request({
    url: 'star/verify/' + starId,
    method: 'put'
  })
}

export function deleteStarByStarId(starId) {
  return request({
    url: 'star/' + starId,
    method: 'delete'
  })
}

export function getStarByStarPartId() {
  return request({
    url: 'star/pass/part/' + store.getters.userPartId,
    method: 'get'
  })
}

export function conditionSearchStar(condition) {
  return request({
    url: 'star/condition',
    method: 'get',
    params: condition
  })
}